package com.acsior.hibernate.vo;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.acsior.dac.impl.hibernate.vo.GeneratorKey;
import com.acsior.dac.impl.hibernate.vo.HibernatePersistantIntegerIdVO;

/**
 * PostalItem entity. @author MyEclipse Persistence Tools <b><i>powered by
 * Belev</i></b>
 */
@Entity
@Table(name = "postal_items")
@GeneratorKey(tableName = "postal_items")
public class PostalItemVO extends HibernatePersistantIntegerIdVO {

	private static final long serialVersionUID = 6872667372571612769L;

	@Column(name = "barcode")
	private String barcode;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "crCodeID", nullable = false)
	private CdCRCodeVO cdCRCode;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "contragent_id", nullable = false)
	private ContragentVO contragent;

	@Column(name = "description", length = 255)
	private String description;

	@Column(name = "item", nullable = false, length = 255)
	private String item;

	@Column(name = "item_code", nullable = false, length = 50)
	private String itemCode;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "nom_item_status_id", nullable = false)
	private NomItemStatusVO nomItemStatus;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "nom_item_unit_id", nullable = false)
	private NomItemUnitVO nomItemUnit;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "nom_product_type_id", nullable = false)
	private NomProductTypeVO nomProductType;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "postal_service_id")
	private PostalServiceVO postalService;

	@Column(name = "purchase_price", nullable = false, scale = 4)
	private double purchasePrice;

	@Column(name = "recommended_price", nullable = false, scale = 4)
	private double recommendedPrice;

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "postalItem")
	private List<StockItemVO> stockItems;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "structure_id", nullable = false)
	private StructureVO structure;

	/** default constructor */
	public PostalItemVO() {
		this.stockItems = new ArrayList<StockItemVO>();
	}

	/** @return the barcode */
	public String getBarcode() {
		return this.barcode;
	}

	/** @return the cdCRCode */
	public CdCRCodeVO getCdCRCode() {
		return this.cdCRCode;
	}

	/**
	 * @return the contragent
	 */
	public ContragentVO getContragent() {
		return this.contragent;
	}

	/** @return the description */
	public String getDescription() {
		return this.description;
	}

	/** @return the item */
	public String getItem() {
		return this.item;
	}

	/** @return the itemCode */
	public String getItemCode() {
		return this.itemCode;
	}

	/** @return the nomItemStatus */
	public NomItemStatusVO getNomItemStatus() {
		return this.nomItemStatus;
	}

	/** @return the nomItemUnit */
	public NomItemUnitVO getNomItemUnit() {
		return this.nomItemUnit;
	}

	/** @return the nomProductType */
	public NomProductTypeVO getNomProductType() {
		return this.nomProductType;
	}

	/** @return the postalService */
	public PostalServiceVO getPostalService() {
		return this.postalService;
	}

	/** @return the purchasePrice */
	public double getPurchasePrice() {
		return this.purchasePrice;
	}

	/** @return the recommendedPrice */
	public double getRecommendedPrice() {
		return this.recommendedPrice;
	}

	/** @return the stockItems */
	public List<StockItemVO> getStockItems() {
		return this.stockItems;
	}

	/**
	 * @return the structure
	 */
	public StructureVO getStructure() {
		return this.structure;
	}

	/**
	 * @param barcode
	 *            the barcode to set
	 */
	public void setBarcode(String barcode) {
		this.barcode = barcode;
	}

	/**
	 * @param cdCRCode
	 *            the cdCRCode to set
	 */
	public void setCdCRCode(CdCRCodeVO cdCRCode) {
		this.cdCRCode = cdCRCode;
	}

	/**
	 * @param contragent
	 *            the contragent to set
	 */
	public void setContragent(ContragentVO contragent) {
		this.contragent = contragent;
	}

	/**
	 * @param description
	 *            the description to set
	 */
	public void setDescription(String description) {
		this.description = description;
	}

	/**
	 * @param item
	 *            the item to set
	 */
	public void setItem(String item) {
		this.item = item;
	}

	/**
	 * @param itemCode
	 *            the itemCode to set
	 */
	public void setItemCode(String itemCode) {
		this.itemCode = itemCode;
	}

	/**
	 * @param nomItemStatus
	 *            the nomItemStatus to set
	 */
	public void setNomItemStatus(NomItemStatusVO nomItemStatus) {
		this.nomItemStatus = nomItemStatus;
	}

	/**
	 * @param nomItemUnit
	 *            the nomItemUnit to set
	 */
	public void setNomItemUnit(NomItemUnitVO nomItemUnit) {
		this.nomItemUnit = nomItemUnit;
	}

	/**
	 * @param nomProductType
	 *            the nomProductType to set
	 */
	public void setNomProductType(NomProductTypeVO nomProductType) {
		this.nomProductType = nomProductType;
	}

	/**
	 * @param postalService
	 *            the postalService to set
	 */
	public void setPostalService(PostalServiceVO postalService) {
		this.postalService = postalService;
	}

	/**
	 * @param purchasePrice
	 *            the purchasePrice to set
	 */
	public void setPurchasePrice(double purchasePrice) {
		this.purchasePrice = purchasePrice;
	}

	/**
	 * @param recommendedPrice
	 *            the recommendedPrice to set
	 */
	public void setRecommendedPrice(double recommendedPrice) {
		this.recommendedPrice = recommendedPrice;
	}

	/**
	 * @param stockItems
	 *            the stockItems to set
	 */
	public void setStockItems(List<StockItemVO> stockItems) {
		this.stockItems = stockItems;
	}

	/**
	 * @param structure
	 *            the structure to set
	 */
	public void setStructure(StructureVO structure) {
		this.structure = structure;
	}

}